package demo1;

class B {
    public B() {
        // do nothing
        func();
    }
    public void func() {
        System.out.println("B.func()");
    }
}
class D extends B {
    private int num = 1;

    public D() {
        super();
    }
    @Override
    public void func() {
        System.out.println("D.func() "+ num );
    }
}


public class Test2 {
    public static void main(String[] args) {
        //1. 分配内存空间  2. 调用合适的构造方法
        D d = new D();
    }
}